The MultiViewPanel allows multiple views to be used in an application, which are accessible via its Views property or in XAML via its PanelViewsProperty attached property. Views can be switched easily and automatically, and animations are used to render the change from one view to another.
The following XAML shows how to set up a MultiViewPanel with two StackView views and a PathView.
<xclb:ListBox.ItemsPanel>
<xclb:ItemsPanelTemplate>
<xclb:MultiViewPanel>
<xclb:MultiViewPanel.Views>
<xclb:StackView Orientation="Vertical"
ListBoxItemConfiguration="{StaticResource OrderItemConfigurationForVerticalStackView}"
IsActiveView="True" />
<xclb:StackView Orientation="Horizontal"
ListBoxItemConfiguration="{StaticResource OrderItemConfigurationForHorizontalStackView}" />
<xclb:PathView ListBoxItemConfiguration="{StaticResource OrderItemConfigurationForPathView}"
ListBoxGroupHeaderConfiguration="{StaticResource pathViewCategoryGroupHeader}">
<xclb:PathView.PathConfiguration>
<xclb:PathConfiguration PathGeometry="{Binding Source={StaticResource SShapePath}, Converter={StaticResource stringToPathGeometryConverter}}"
PathPadding="50,100,50,100"
ContainerPadding="-100">
<xclb:PathConfiguration.ScalingStops>
<xclb:ScalingStop Offset="0"
ScalingFactor="0.15" />
<xclb:ScalingStop Offset="0.5"
ScalingFactor="1.2" />
<xclb:ScalingStop Offset="1"
ScalingFactor="0.15" />
</xclb:PathConfiguration.ScalingStops>
<xclb:PathConfiguration.ZIndexStops>
<xclb:ZIndexStop Offset="0"
ZIndexFactor="0" />
<xclb:ZIndexStop Offset="0.5"
ZIndexFactor="1" />
<xclb:ZIndexStop Offset="1"
ZIndexFactor="0" />
</xclb:PathConfiguration.ZIndexStops>
</xclb:PathConfiguration>
</xclb:PathView.PathConfiguration>
</xclb:PathView>
</xclb:MultiViewPanel.Views>
</xclb:MultiViewPanel>
</xclb:ItemsPanelTemplate>
</xclb:ListBox.ItemsPanel>
The IsActiveView property determines whether a given view is the one that is currently active. Setting a view's IsActiveView property to true automatically performs the switch and results in the view switch :
Public Sub ChangeActiveView(ByVal newActiveView As View)
If newActiveView Is Nothing Then
Debug.Assert(False, "newActiveView cannot be null")
Return
End If
newActiveView.IsActiveView = True
End Sub
public void ChangeActiveView( View newActiveView )
{
if( newActiveView == null )
{
Debug.Assert( false, "newActiveView cannot be null" );
return;
}
newActiveView.IsActiveView = true;
}